Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backporting "Fix policy condition calculation" onto release/0.28 #1008

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

junderw
Copy link

@junderw junderw commented Jun 16, 2023

Fixes #942

Description

This backports "Fix policy condition calculation" (#932) onto release/0.28

Notes to the reviewers

Currently kept the Author the same and the committer is myself. Let me know if this is not the desired outcome of the history. (I have made no modifications myself)

Changelog notice

Backported "Fix policy condition calculation"

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

When constructing the `Condition` struct we recursively call
`get_condition` on all the items in a threshold and short-circuit if
there's an error somewhere (for example, because the policy-path hasn't
been provided for a specific threshold).

This can cause issues when the user doesn't care about a subtree, because
we still try to call `get_condition` on all the items and fail if
something is missing, even if the specific subtree isn't selected and
won't be used later on.

This commit changes the logic so that we first filter only the `selected`
items, and then unwrap the error using the question mark. If errors
happened somewhere else they will be ignored, as it should.
@junderw
Copy link
Author

junderw commented Jun 16, 2023

Also, please let me know if I should point it at a different branch.

@nondiremanuel nondiremanuel added this to the 0.28.1 milestone Jun 17, 2023
@notmandatory
Copy link
Member

Thanks for doing this backport, commit history is fine. Seems to be some tests failing though, I can help take a look if you like.

@junderw
Copy link
Author

junderw commented Jun 20, 2023

I found the issue. Everything should build now.

Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9cffaad

Test fix looks good.

@notmandatory notmandatory merged commit 6097957 into bitcoindevkit:release/0.28 Jun 26, 2023
@notmandatory notmandatory mentioned this pull request Aug 3, 2023
12 tasks
notmandatory added a commit to notmandatory/bdk that referenced this pull request Aug 3, 2023
Summary

This patch release backports (from the BDK 1.0 dev branch) a fix for a bug in the policy condition calculation and adds a new taproot single key descriptor template (BIP-86). The policy condition calculation bug can cause issues when a policy subtree fails due to missing info even if it's not selected when creating a new transaction, errors on unused policy paths are now ignored.

Fixed

- Backported bitcoindevkit#932 fix for policy condition calculation bitcoindevkit#1008

Added

-  Backported bitcoindevkit#840 taproot descriptor template (BIP-86) bitcoindevkit#1033
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants